package gof_003_行为型_Behavioral.gof_003_观察者_Observer.gof_002_Observer;

public class Observer_XiaoHong implements LampObserver{
    private String observerColor;

    public String getObserverColor() {
        return observerColor;
    }

    public void setObserverColor(String observerColor) {
        this.observerColor = observerColor;
    }

    @Override
    public void update(Lamp lamp) {
        //将观察者的颜色 设置为 灯的颜色
        this.observerColor = lamp.getColor();


        switch (observerColor) {
            case "绿":
                System.out.println("绿色保持正常,我是小红,我在化妆...");
                break;
            case "黄":
                System.out.println("黄色表示预警,我是小红,跟同伴眼神沟通...");
                break;
            case "红":
                System.out.println("红色表示行动,我是小红,我去勾引看守...");
                break;
        }
    }
}
